Merge PR https://github.com/cocos2d/cocos2d-x/pull/3342, some more clean up (code review)