fix #747

added a test as well. reviews of the test are welcom
Merge pull request #748 from m1keil/master

fix #747