fix flaging bug