fix object identity for rectangle and fix contract for square