various fixes / optimizations to js client