Fix checks for AJAX requests