Fixing error logic in new path insertion code.