Can I get a url to reproduce? It is probably keeping the sorting parameter in the url which resets the sort. The solution is probably to check for the sorting url parameter on or around like 192-193 and omit it from the navigation url just like the two parameters already listed on those lines are.