fixed bug when reverting