Fix bug preventing paths from forming correctly in some circumstances