action based on step_flag