Patch for issue #294 (thanks to @eltjpm)