Fix model loading bug when embedding