core: fix variable declaration used in several loops
core: suppress type error exception