fixed js and other bugs