added endtexture code