backporting fix to issue #210