modernized socket usage and hopefully fixed unloadModule()
more fix-ups