Fixing some stuff for upgrade