fixed a crash in automaterial plugin