fix saving of figures with show in main()