more fixes and better path generation for hooks