fixed bugs with process environment