Fix few bugs in the cleint: handle exception in the other thread, don't
crash whhen ENTER is pressed.