Fix "Unbound variable: output" error when debugging, correct usage, improve operation as 'root'