fixing socket exception