closer check of boundary conditions