fix error when curdir is different from given path