Fixed a bunch of matrix things