fixed AJAX bugs