More robust error handling in the rootpy script (and other minor fixes)