fix memory leak with textures