Fix bug on jsapi snippet