Fix AJAX functions