fixing issue with sockets gaining and losing connection