In the dog's defence, he was probably thinking that he was being attacked or something.
It's like if you sneak up on your dog, he'll instantly snap out for your arm.
really, cause my dog will roll over on his back and expect me to rub his belly :l
then again, the only time my dog was ever violent in the least is when neighbor's dog tried to bite my sister...
but yea, sucks man...