Bug fixes in Environment and Grid classes.