Fixes #989
Merge pull request #1001 from mdogan/fix/3.1/989

Fixes #989