[Fix] Apply patch from @bgulanowski for issue #722