deal with invalid cwd