HTC M9 with t-mobile locked phone and Nightmare!

A

AC Question

Hi,
I really need help as im digging myself into a bigger hole!
I have recieved a new HTC m9 from uh-oh protection. The phone is T-mobile locked .
I am using Cricket now.
I have bought the Unlock code and HTC actually gave me the unlock code and its the same.
Since its T-mobile locked they have the app that is called : "unlock device" naturally this app doesn't work for me since i am not a t-mobile user .
So i rooted the phone . and installed cyanongenmod.
The good part is that it prompted me to enter device unlock code.
That device unlock code didn't work! Why??? i m stuck here
how do i get a better software ?