Fixed debug handling to check that the debug file exists before loading it