Pull request #3425 with @dildick's modification

#3425 has a parenthesis error spotted by @dildick.  Since I can only merge entire pull requests I added his fix on top and put it in as a new pull request.