fix hang when debugging shiny apps in some circumstances (avoid R hang in capture.output for shiny S4 object)