add condition on query wich fix possible bug