bug in client creation logic