switch debug to ui.writeLine