fix bug when delay is less than zero