Fixed up javascript errors