compiler: fix checkRef