New matrix sum algorithm, removed heap corruption.