core: fix complex conditions with mode alternation (fix #31)