Use non-deprecated method to get cwd