fix invalid javascript issues