Fix bug where formatted error messages were being displayed even when no error was present