fixed typing error with js function