Fix bug with pagining