Fixes to function cache