bugfix in matrix