Fixed js bugs