Small fixups, tests should now pass and not leak/badaccess