Fix version comparison in upgrade