Fixed object reorder, tuple write, and memory leak issues