I done factory reset and everything - didn't help.
I gave the phone to the guy who rooted it and he said he will install the software again. Hopefully this will help.
EDIT: The guy said that there is no problem with the phone, apparently the root causes the phone to automatically start when switched off.
Can I unroot the phone by myself? I was thinking that I could delete the root and then ask TMobile if they can give me an unlock code.