fix fitIn and fitOut operation