more backporting from client-test