Fix xref query and error emission
Fix file scanning madness