fixed issue causing immediate disconnection of socket
Merge pull request #344 from theJenix/fix_090

fixed issue causing immediate disconnection of socket