Fixed compilation errors under VS 2010 and Win 7