Fixed upgrade errors