Initial pass of bugfixes after testing.