fixes #2112 ( backport of #2136 )