Fixed a bug that was causing the key to be written to the cache when it shouldn't be.