Migrate some changes from Cocos2d-JS to -x