Default [Q] HTC One WiFi glitch

Hi guys!
When I try to turn on WiFi it does not .. Sometime it turns on,finds network but when I click ''connect'' It freezes ..
What to do? I'm on 4.4.2 KitKat,tried factory reset .. same problem..
Thanks in advance.