Correct handling of debug mode