Fix js bugs