correcting javascript