modify matrix multiply