fix #3396

compiles and runs fine for me in vs2012 with these fixes