Throw NotFound and CannotDereference Exceptions

This change is to throw more specific exceptions in several cases when
possible. If an object cannot be found, throw a more specific
NotFoundException. If an object exists but cannot be dereferenced to its
desired type, then throw a CannotDereferenceException.