Fix handling of non-anonymous funcs in JavaScript