Patch for issue #289 (thanks to @eltjpm)