woops reset the flag in the wrong place