fix bug in page detection.