Thanks very much for explaining! I was confused because when the number of stack elements was 4 the first stack item always had a zero length.
That's probably for multisig scripts which require that the first stack element be empty due to a bug in the way that OP_CHECKMULTISIG works.