added optional run_hook for error checking