Bugfix for matrix