fixing socket code