add case when socket has already finished