Fixed module unloading error and tweaks