Added null check for portType and methods[methodname].output