Fix up javascript errors preventing some of the functions from working