Module loading bug fixes