better checking of checkboxes