Attempting to backport more things from 0.9.12, although it's not going very well.