Fixes variable name in setMaterial function

- The setMaterial function incorrectly referenced an array. This has
been corrected.