Improved 'cd' command to process some exceptions