fixed race condition for loadModule