refactor _resolvePath