Hello, there may be several reasons why your phone does not accept the code
One problem can be that the phone is non-updated or after firmware downgrade. Just upgrade the phone to the last firmware version and do the master reset, make OEM unlock, the phone will accept the codes.
Also, check maybe it is TMB phone with not original firmware.