Fix API to export to JS environment