MDL-37993 quiz completion: fix some issues with the previous code.