Fix problems with %cwd