Patch for issue #406