Bug fix and minify javascript code

Bug fix and minify javascript code