Fix bug when rolling back