improve waitssh shell function