fixes github issue #14070 PR based on https://github.com/cocos2d/cocos2d-x/pull/14098 by @firefly2442