The problem could come from the error handler that processes the attempt to do additional action while an action is performed. The code probably does not return to execution of original action after error handler popping up message "you are currently using something else (or somesuch)" resulting in delete object action not being performed (i imagine it is in the end of eat function)
Note: I have not seen a single line of the code so speaking purely from general programming experience.