fixed segfault in server if client lost connection