fix appending bug in arrays'