Fix bagname problems