Fix atomic operations on context_flag without altering semantics.