fixing upgrade bugs