Added some precautions if subprocess fails. If notebook is picted, make the pic height bigger.