fix some minor js bugs