Fixed js bugs.