Fix a bug that three or more sections case in W pragma doesn't work

fixes #1770

Reported by shizuin. Thanks!!!