fix Waypoints array index out of range access