The time period when the got all messed up was back when NPC::AI_SetupNextWaypoint() was added as it's own routine.
But here is a patch, probably only would work with my own source, but here it is anyway.
Never used this service, lets see if it works...
http://pasted.co/27ab2a6c