applied fixes for windows

http://stackoverflow.com/a/24763080/3922441