fixed bug matrix/array issue