improve upgrade framework