Fixed error handing in fileutils.