Patch for issue #286 (thanks to @eltjpm)