fix append problem and add the same tests