TODO: check for failures in call_script_hook only once