Bunch of other fixes that go along with the last commit.