Fix broken check for top-level var/defs in IDR