Fixed pagination bug