Made addstudent_ajax slightly more robust

And added some logging.