core: refactor 'if' regions processing
core: fix condition processing errors