Fixes:
 - byte order of ipv4 port
 - segfault when calling socket errorhandler