fixe bug in query