modules: fix module waiting for dependent modules' init