I believe I had a similar problem before andthat calling asset(Asset); before my asset loop fixed it whilst still enabling global optimisation.