Fixed a typo and javascript bugs