Fixed bug where materials would get destroyed multiple times.