Fix rtd builds for 0.9.x

Backport some of our previous fixes from `master`.