code for pull request #126