Changed the way of checking the build flag in WG

If you find another way to do it, you're welcome to try, but I think this is a good way to check the build ability :)
Merge pull request #124 from richie3366/master

Changed the way of checking the build flag in WG