Use ctl.output() instead of ctl.stdout.write()