diff --git a/lib/ssh.c b/lib/ssh.c
index 646c9fc..a02f17e 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -510,7 +510,7 @@ static int sshkeycallback(CURL *easy,
  * to will be set to TRUE if the libssh2 function returns LIBSSH2_ERROR_EAGAIN
  * meaning it wants to be called again when the socket is ready
  */
-
+static int nasty_horrible = 0;
 static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
 {
   CURLcode result = CURLE_OK;
@@ -1600,6 +1600,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
         sshc->orig_waitfor = data->req.keepon;

         state(conn, SSH_STOP);
+        printf("Setting nasty horrible...\n");
+        nasty_horrible = 1;
       }
       break;
     }
@@ -2409,9 +2411,9 @@ static void ssh_block2waitfor(struct connectdata *conn, bool block)
 {
   struct ssh_conn *sshc = &conn->proto.sshc;
   int dir;
-  if(!block)
+  if(!nasty_horrible && !block)
     conn->waitfor = 0;
-  else if((dir = libssh2_session_block_directions(sshc->ssh_session))) {
+  else if(!nasty_horrible && (dir = libssh2_session_block_directions(sshc->ssh_session))) {
     /* translate the libssh2 define bits into our own bit defines */
     conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
       ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
