Finally managed to find the bug. It turns out that the ordering info was wrong for NonTerminalState and ExiState of the called NT.