fixed bugs for VS2010-VS2012 compatibility