updated and fixed bug of javascript saving