make sure material is valid