Expose platform name to JS, miscellaneous fixes