Improves AJAX error handling