Compilation fix and diagnostic improvement