improved upgrade task