Fixed a bug where the output wasn't getting reset properly