Cherry-Pick commit from @mgmax. Fixes #109