add condition checking