Better output handling of errors