Variable scope fix for show_output