fixes to json parsing in js