Fix a bug when evaluating if an item exists or not