Changed the waitForClient function.