Various fixes (and more will come)

We're using this package internally, and had to fix various issues we've come across.