improve ssh aborting condition to make ssh connection more stable