fix post_hook with warning in global variable