Fix a few niggly bugs from a test run through, still unstable.