Fix bugs on JS for widgets.