Avoid unnecessary get_key during listing, fix potential TypeError in _CheckAndHandleCredentialException.