bugfixes to get linear chain to run. Now runs