patch for issue #40