Fixed a few small issues in various js files. Fixes #251 and hopefully #...

...244.