Fix crash when pages is higher than reality