fixed infinite loop bug, wait for cxn