bugfix: moving perflog print and clear commands outside the if-block for reconnecting output buffers