Fix bug in ModuleFactory