Made server slightly better at handling error cases with client.