Fixed client loop when server crashes