Fixed javascript bugs.