fixed bug in which matrices would be added twice
fixed the bug in which matrices get added twice