fix segment handling in jsapi model