Fix output handling