I was looking at your circuit again and it occurred to me that your NAND gates may have an issue with the stacked transistors not having a low enough voltage to provide a logic LOW.
Wikipedia has this configuration:

R3 is sometimes replaced with a diode and R4/V- eliminated (my preference). That has the effect of requiring more than a diode drop to turn the transistor on.
I used BC547 for this circuit:

Wikipedia has this configuration:

R3 is sometimes replaced with a diode and R4/V- eliminated (my preference). That has the effect of requiring more than a diode drop to turn the transistor on.
I used BC547 for this circuit:
