Fix build for mingw32

This patch close #1296