Fixed order of check-ups when generating or updating cache file.