a few bugs fixed, updeted invert_test.cpp file