Made a few fixes to the v2 of getMethodInvocations.