fix some unit upgrade logic