Fix missing files import, and add a debug error printout