Fixes critical bug in CommitMemoryLayout