Fix incorrect arithmetic in dot-product.