fix bug shape of matrix