remove actions at the right time