WAIT CONNECT not working: while loop is infinite