fixing bug related to socket error