Clear a flag value correctly