Patch for issue #283 (thanks to @eltjpm)