More VS2012 compat changes and small fixes
Merge pull request #2 from ochilan/master

More VS2012 compat changes and small fixes