Update from origin and re-apply fixes

See #1 - this applies some of those fixes to origin/master. (Others have been fixed in origin already!)