Fixing some AJAX issues