Corrected usage of rules[].
Rename mod to Mod.
Adapted setEnv().