some validation for tpcode