Corrected a bug with AJAX