I144

This implements the changes to material.cpp originally added in PR #144 (but could not be easily cherry-picked).