cleanup matrix
cleanup vector