Debug assertion fix during destruction phase, code cleanup.
Merge remote-tracking branch 'ConsoleRendering/master'