Fixes interface ref,unref issue
Fixes the copy function for txt