bug fixes, js improvements