fixed all the broken refs and other small thigns