Fixes issue with variable type being undefined

Pass the variable type to _getTargetName() to prevent this error from happening