Exception handling and auto_file variable fix