Fix ScriptFilter cache key calculation

Fixes #2651