flush operations should be done if everything is ok when $success is true