Handling rollback when necessary.