fix function to take the hook param