Fix bug in outputTo