fixed bugs (matrix, and vectors)