Fixes from udp branch