Fix issue with hook logic