Fixed bug in client authentication logic