how the hell?!?!

How the hell are people finding out the gender at 13 weeks with an ultrasound?!?! I don't get it. I thought genitalia isn't developed enough until around the 17th week. I'm so confused.