Fix scan bug not properly fixed by commit 20f422c052 and add compiler tests