Fixed crash while trying to write to stdout. All should work fine now.
Tested on Windows 8.

Signed-off-by: Alex Sardan <sardanalex@gmail.com>