fix of mix-and-match attack and indefinite-freeze-attack

This fix the mix-and-match-attack and indefinite-freeze-attack and sometimes connection refused error also.