Cowboys beat Bengals 24-18