Fixed some issues with the ajax calls