fixing some little js bugs