improved texture handling