solve the problem and add a new function:append