updated test for inverting matrices