fixed a bug in the db query class