added max number of iterations to prevent crash in setDestination