fix issue #2019 and added tests
Merge pull request #2328 from maxgalbu/issue2019

fix issue #2019 and added tests