modified check for portState