Remove empty hooks when running last function