Fixes bug where it crashed when there was no more pages