more changes to help keep from getting exception when python exits