added onAppend callback