This may be the only fix needed for rectangles.
Needs extensive testing