fixed bug that ignored first index of learntMat variable