Saving flags properly