[MH,RG] add the test for the undo in the toss and fix some bugs