Fixed a flaw when setting a texture to a model