Fixed some problems with the pagination (issues when used with the back
button).