added check for nil process state