optmize delete function

optmize delete function