fixing scalar matrix multiplication