fixed bug when cwd is null