Fix JS exception when notes are flagged out