Added an alternative patch for #1083, which might actually work quite well.