Fix bugs caused by using struct asock for UDP.