Fixed random freezing bug when swapping pokemon.