Various patches and improvements

travis build is broken due to a misconfiguration of `compatibility.min.js`, so I haven't changed `.travis.yml`.
But I'll fix it soon, so this is OK.