Fixed unhandled socket error, on this way it shouldn't "hang".