Some optimization and bugfixing on the socket receiver.