Update JS

Fixed some bugs