javascript: fix for #1580