Fix a crash of the TextureManager