fix infinite loop in trip planning