After a deeper look, "fileStats" must be a local variable and checkFile() should return "fileStats".
In that case, you must keep "configStats" at line 145.
and in loadMainConfig  assign to configStats the value returned by checkFile().

Otherwise, your current "fileStats", which is global is modified several time when checkFile() is called for different files.