Several fixes throughout.