fixed environment bugs