making check boxes work correctly