more bug fixes in the javascript