That is, store the button pressed state in a session state and use that for your further steps (say step-3).
The problem occurs because when you press a button in step-2, it will be marked as true only during the first refresh. When you change anything beyond that, the subsequent refresh will return false for the button pressed state.