Improve rollback logic