Fixed an issue with hooks and custom return types