Applied torotil's patch https://drupal.org/node/927690#comment-6542702