fixed a number of warnings as errors; removed a small amount of redundant code; fixed build.bat

fixed a number of warnings as errors; removed a small amount of redundant code; fixed build.bat