Fix scope issue in example js