Fix cache dependencies

The form cache was ignoring whether the Functions passed in as
dependencies the second time around were the same as those used in the
cache. This is clearly wrong.