Fixed pagination error in query results.