Fix crash on re-analysis as well as other related re-analysis bugs.