Applies the fixes, fixes failing tests and some minors

I checked the initially failing tests and from my point of view those
that failed initially have actually been wrong.