Fix some ajax bugs.