Fix ajax functions