Apply patch from #297 (not a fix). Thanks to @eltjpm