Fixing some error handling in the client.