fix up state on ajax