Added support for terabyte, fixed scratch env.