I forget to mention, that I have only two assets in the assets file:

Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Leverage,LotAmount,Commission,Symbol
SPY,215,0.02,0,0,0.01,0.01,0,4,1,0.02,
YHOO,215,0.02,0,0,0.01,0.01,0,4,1,0.02,

The second version of the code doesn't crash. Only the first version of the code causes crash, which is the version where asset(assetName) is after contractUpdate. And it crashes only once, one day after lookback period.