db query fixed