Fix texture mapping.
Add back stdexcept.