fixed error with matrix