fixed upgrade bug