Reproduce issue #316
Add detailed test for #316 and fix it; fix to be discussed though.
Add tests to TestSuite
Merge branch 'bugfix/issue316' into develop