Collection of fixes replaces #42, #56, #63

Tests to show issues.
Fixes for those issues.