Fix bug of mandatory flags with leftovers