Fixed a "matrix product must have same inner dimensions" error.