foil module-name-checking logic