implemented rollback function