Shameful buggy AJAX