improved texture model loading code