Issue #183: Backports from Drupal 7.16, SA-CORE-2012-003.
Merge pull request #168 from quicksketch/SA-CORE-2012-003

Issue #183: Backports from Drupal 7.16, SA-CORE-2012-003.