fixed potential bug in append