fixed a bug in query class