Added basic threading support and fix unix sockets