Fix Sexp hash cache invalidation

Minor performance gains (like 2% on one app).

Hash cache was being reset some places it didn't need to be, and not being reset some places it ought to have been. Not sure if there was any real impact on correctness.

Or maybe I just like saying "hash cache".