Fix for paths with multiple identical nodes