Important bug fix: condition to check for do_matrix_multiply was sometimes failing due to integer overflow.