Fixes CachingDatabase caching incomplete objects and sometimes causing issues later when querying for the same objects.
Fixes resolved references being messed up after atomic operations.