Fixed many crucial bugs in the sockets and the packet handling as well. causing crashes