rudy's fixes for matrix math