add exception handling for invalid page