add revert function and test