Fixed so that textures and tetxure ids are used correctly.