Fix compile errors with VS2010-2012

based on Larry Gritz' pull request with one more fix to fix compilation
on VC2010 and VC2012.