Improved checkFile call