issue #3251 improve code for cocostudio