Improving error handling, all ref-counting tests pass (#177: Implement distributed AGAS)