fix material reference index issue