Add checks for object deleting and fix bug in container delete.