fix upgrade bug