basic matrix operations, fixed a critical SGScript bug