Misc javascript fixes