Patch for issue #288 (thanks to @eltjpm)