Merge "Fix bugs in AllocationAdapter."