Code fix for pull request 165