Fixing a matrix multiplication error