Migrating to JS sdk, handling stream errors, more bug fixes