removed extraneous variables, added check for build_dir to match basedir if nothing set initially for batch files