Seems you forgot to remove $deleteAll completely ?
Beware because below there's some error logging done with it, so not sure how to proceed from here.