fixing result page sorting and pagination