Fixed up ajax bugs