Js bugfix

ok so maybe this wasn't impossible.   @terenceingram want to check if this works for you?