working on fixing bugs with matrix analysis