Fixed double-freeing of string when double casting