better page detection