small changes in hook to make it network friendly. Added mutex in udpnetwork code