fix flagged & andWhere bug