Fixed bug in texture generation.