Added foreach_safe also on udp