commit a tweaked version of Daniel's patch for PR3599. We now