Added a check for the files object