fix flap checking bugs