fixed bugs and sockets