Fixes bug with pagination