Fix issue 806

Fix #806
Merge pull request #809 from cristianoc72/issue-806

Fix issue 806