Fixes and changes towards v4.0.0-final