preserve stty settings

 * saves and restores stty settings instead of overwriting them with
   sane