some improvements to matrixfit