added matrix stack pop
fixe material mode switch + cleanup