Fixed bug in the cache.

It was re-running the select statement and makign the
assumption that would return the same instances as the
original - which in this case it wasn't