correctly used cwd for subprocess