Fix a bug in Path detection