Add autoload cookie to hook function