fix texture to file function