exception handling for 'cd'