Fix Rect detection and Segfaut on one page PDF