corrected error handling in ...new_from_file