improve editRectangle handling. Fixes #135