* commit 'f65dd213900603116c7b064bfdfb57662f7682c3': Change order of operations so flag is not overwritten