fixed bugs in addToEPMaterial library