Patch for issue #471

See comments of issue #471