fix rectangle creation bug