Fixed undefined cwd variable bug