Improved implementation of hasVarArgs to be more robust