Add tests for issue 1010
Add test for issue 3989
Merge pull request #2464 from skirpichev/1010-tests

Add tests for issue 1010