Fixed error check
Fixed memory leak in blobs