fixed a flaw in path convertion algorithm