bug in query