Some minor logical error fix in the module loading logic