petea - fixed bug in runChain function