updated to resolve socket bug