Applied patch from https://drupal.org/node/828028 comment #7