Various fixes, mostly for the module internals being reusable