Issue #184: Backports for SA-CORE-2012-002.
Merge pull request #167 from quicksketch/SA-CORE-2012-002

Issue #184: Backports for SA-CORE-2012-002.