Backport fix for #44 to 1.2 branch.