The first fixes. Will continue later.

Will continue later at some point.