making checkbox work appropriately