takes care of all file input errors