I have strange results of logistic regression:

The model is following:

dependent: success of treatment, 0 - No, 1 - Yes,

possible predictors: treatment, 1 or 2 (numeric) and sex with 2 different codes, first: (F=0, M=1), second: (F=1, M=0).

If I build regression with treatment alone, then coefficient for treatment is significant (p=0.03).

If I build regression with treatment and sex (both types of codes) without interaction, then coefficient for sex is not significant, coefficient for treatment is significant (p=0.02).

If I build regression with treatment and sex (FIRST type of codes) with interaction, then coefficient for sex is not significant, coefficient for treatment is NOT significant (p=0.38), interaction coefficient is not significant.

If I build regression with treatment and sex (SECOND type of codes) with interaction, then coefficient for sex is not significant, coefficient for treatment is significant (p=0.03), interaction coefficient is not significant.

I don't understand, why significance of treatment depends on which type of codes I use for sex.

Did anyone have to deal with such a situation?

Many thanks in advance!