Fix boundary conditions