Add the key parameter when getting entries
Fix a condition bug.