fix issue-1313. Functional test passes
Merge pull request #1314 from drunkel/master

Closes #1313. Functional test passes