fix deletion logic in startup