Port fix for #234 to 1.7.