(fix) Assorted upstream fixes.
Merge pull request #37 from reem/fix/upstream

(fix) Assorted upstream fixes.