fixes #678
Merge pull request #697 from sancar/fix/3.1/issue678

fixes #678