Fix some javascript bugs.