fix trim_coordinates