fixed various ajax bugs