Fix flavor delete bug, and add more conditional checking before runing cmd