Fixed a few JS bugs.