Fix issue with udp port registration when running multithreaded