fixed pointer problems and guard in material files
Merge pull request #423 from tdev/material-ptrs

fixed pointer problems and guard in material files