some improvements and NPE for revert()