fixed displaying too many pages under some circumstances