fix rendering of materials with indices of 256 and above

As per the title