You should change the subject to "KIX ver. 3.50.0.0 and limitations with amount of stack space".

Every time KiX encounters an IF, it pushes to the stack. When it finds the ENDIF, it pulls from the stack. You MUST match the number of IFs with ENDIFs. Ruud does do stack cleanup to compensate for sloppy code but it has its limits.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.