Fixes #1374 Class methods called by hooks cannot accept arguments by reference