Fixing a bug when debug is enabled

Using the -d options causes a `NameError: undefined local variable or method `app' for main:Object`
Fixed it by removing the reference to it and gathered the debug commands into one block.