Refactor #4365: Fix bugs and update cocos2d-html5