Various bug fixes for IPv4 support