This code crashes when "Contracts" is zero. Which happens on all assets except SPY and YHOO. So don't use the Contracts pointer except when contractUpdate was called before and didn't fail.