modified error handling in func ...graph_new_from_file