several fixes for datumgrid and environment.