fix infinite loop in paging by clearing Next/Previous fields from previous query