diff --git a/src/io.c b/src/io.c
index 33a810850925fabb37500f8118322081cad52464..199855a3af2d61e90569099b549d230ff0bb509a 100644
--- a/src/io.c
+++ b/src/io.c
@@ -271,7 +271,7 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, int dim
 void read_ic ( char* fileName, double dim[3], struct part **parts,  int* N, int* periodic)
 {
   hid_t h_file=0, h_grp=0;
-  double boxSize=0.;         /* GADGET has only cubic boxes (in cosmological mode) */
+  double boxSize[3]={0.,-1,-1};         /* GADGET has only cubic boxes (in cosmological mode) */
   int numParticles[6]={0};   /* GADGET has 6 particle types. We only keep the type 0*/
 
   /* Open file */
@@ -303,11 +303,15 @@ void read_ic ( char* fileName, double dim[3], struct part **parts,  int* N, int*
     error("Error while opening file header\n");
     
   /* Read the relevant information and print status */
-  readAttribute(h_grp, "BoxSize", DOUBLE, &boxSize);
+  readAttribute(h_grp, "BoxSize", DOUBLE, boxSize);
   readAttribute(h_grp, "NumPart_Total", UINT, numParticles);
 
   *N = numParticles[0];
-  dim[0] = dim[1] = dim[2] = boxSize;
+  dim[0] = boxSize[0];
+  if ( boxSize[1] < 0 )
+    dim[1] = boxSize[0];
+  if ( boxSize[2] < 0 )
+    dim[2] = boxSize[0];
 
   /* printf("read_ic: Found %d particles in a %speriodic box of size [%f %f %f]\n",  */
   /* 	 *N, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
diff --git a/src/space.c b/src/space.c
index 65c6a6711730c14b9b0d01ca474c9a104dc1b1b7..8320753ceb887781bb43060dd8e8c88168da3734 100644
--- a/src/space.c
+++ b/src/space.c
@@ -377,7 +377,7 @@ void space_rebuild ( struct space *s , double cell_max ) {
         
     /* Do we need to re-build the upper-level cells? */
     // tic = getticks();
-    if ( s->cells == NULL ||
+    if ( 1 || s->cells == NULL ||
          cdim[0] < s->cdim[0] || cdim[1] < s->cdim[1] || cdim[2] < s->cdim[2] ) {
     
         /* Free the old cells, if they were allocated. */
@@ -451,6 +451,7 @@ void space_rebuild ( struct space *s , double cell_max ) {
         error( "Failed to allocate temporary particle indices." );
     ih[0] = s->ih[0]; ih[1] = s->ih[1]; ih[2] = s->ih[2];
     dim[0] = s->dim[0]; dim[1] = s->dim[1]; dim[2] = s->dim[2];
+    cdim[0] = s->cdim[0]; cdim[1] = s->cdim[1]; cdim[2] = s->cdim[2];
     #pragma omp parallel for private(p,j)
     for ( k = 0 ; k < nr_parts ; k++ )  {
         p = &parts[k];