remove duplicating code
Merge pull request #1628 from dryabov/master

remove duplicating code