Fixed bug with materials.