fixed bug where multiple modules in the same resource could cause a module to be used prematurely