fix coordinates from rectangle