fix problem with abruptly closed connections