Fixing upgrade bug