Fixed a typo
Fixed a memory leak in the local add_ref