rectangle fixes, and add test