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

Tests to show issues.
Fixes for those issues.