Fixed errors and warnings given by VS2010