check the matrix inverse, rest checked and working.