replaced the deprecated hook.