update stack if condition