few changes to matrix.hpp