Applying 7b41a76 from Terry-Mao.
Merging d8b6034 from Terry-Mao
Merged Blob(), SetFormat() and memleak fixes for Error(), from Terry-Mao.