minor improvement of matrix and rhs script
minor improvement