fixed js errors and typos