various javascript fixes