bugfix in sockets exceptions handling