fixed up javascript