Fixed bugs with AJAX adding and deleting