fixed trace errors and environment errors.