fix hook implementation