Fix error when calling hooks in site generation