fixed not capturing flags bug