added error handling on client side (connection lost)