Fix issue #39 (Material dispose doesn't work with some material types)