fixing some small js bugs