Fix for fluky problem 'argument out of range'

The fix changes using of "getDeclaration" routine to using of "getFunction" routine for looking for intrinsics in our module.