Fix bug in javascript example