fix some js bugs that prevented minification