fix: module loading order after flattening