Fix some bugs w.r.t environment info collection