better condition checking