Fixed upgrade scripts