core: fix 'this' reference in anonymous classes
core: improve error reporting for inconsistent code
core: fix loop detection