Repackage and fix some js bugs