delete -> delete[]
fix bug: do not write data after timeout