Fixed some stuff related to checking client connection.