issue #2828: Improve code for Cocostudio.