small fixes, mostly to use proper array iteration in js client