performance improvement

cache type() check of node/function/model, always check if it's string
before trying to execute that string as a function.