Fix bug in AJAX/python communication