Patch for issue #290 (thanks to @eltjpm)