Apply the fix in all to_rect functions