Fixed Visual Studio build and related errors.