Fix DebugLevel variable scope