Fix cwd handling.