Fixed a bug with multi-page WHERE queries