Fix for truncated error messages on Windows

This fixes #204
This is serious bug on Windows, so please merge it. Tested building it only on Windows.