fixed some minor js bugs