Update to materials.py

Did this to fix some buggyness on my part, might create problems, if it
does I'll revert.