Fixed AJAX and redirects