gather error messages before outputting them (#51)