Add support in client for new StatData item format
Fix safehtml bug and restore support for secondary data