Added check for 0 pages returned