A more reliable get_file function