Improve the exception handling of the fileutils.