fix output presentation and stack overflow during export