made reversible!
fix bugs in making reversible