added unit tests proving that the problem is fixed
Merge branch 'issue865' into 1.7.x