Fix executing hooks with different prototypes

Note: performance penalty unknown