shouldn't the flag fields be cleared here as well?