fixed connection issue with wait state not properly set