Fix bugs of getting env values