Fix bugs with checkbox handling