Corrected faulty exit and casing of debug flag