Alternate Path causes agents to zig zag

I’m trying to use the Alternate Path class for its titular purpose, however it causes the agents with this class to move in a zig zaggy way, probably due to the fact that every time the path gets recalculated it takes the penalty of the previous path into account. Is there any way to fix this. Thanks in advance!