fixing query to be per page