bug fixes

matrix inversion works