I too would rule out medical. Then I'd question if that tail wag actually meant happy. Usually there are signs leading up to a bite. Maybe you've just missed them?
Either way a dog that bites at kids with real bites that can puncture is a dog I'd get rid of. Maybe it's a bad dog or maybe you failed the dog with your training. Either way there are many stable dogs in shelters that need homes for you to keep around one that's dangerous (whatever the reason besides from medical)