improve socket handling and fix local IP bug
remove system out