Fix bugs in caps plugin

FIx some bugs in caps plugin:
1. don't compare datasets, use flags instead;
2. use full node as key;
3. move getIdentityString to more appropriate place;
4. get rid of Deferred in caps plugin.