fixed js bugs