Fixes to pagination