Fix building the module and restore lost code