fix verifyFunction so that the namespace check is done earlier

This bug was causing problems as was erroneously reporting errors on methods with not matching
parameters but on different namespaces.