Fixed a bug in cache code for getting a single element