optimization for isFunction