Security fixes brought forward from 0.9.7.