Various javascript bug fixes.