Fixed wrong handling of `cwd` parameter