Is this a samsung? Try a factory reset first .
If that doesn't work you can search XDA for a roll back process using ODIN.
If it is for a Samsung device. There is a Samsung Firmware Recovery/Flashing Guide on the boards here. That should answer the bulk of your questions.
Manage your T-Mobile account