few js bugs fixed