Fix some js bugs.