fix for #815
fix for #816
forgot those tests
Merge pull request #817 from leider/master

fix for #815 #816