page out of range check added