Branch fix: No infinite loops during metadata requests, invalidate metadata more, exception hierarchy

This is an update to #91 that properly adds my new commit on top of the upstream changes (I had accidentally performed a rebase instead of merge that put my branch in a bad state).