fixes some bugs for new updateGrid27 function, especially initialization of boundary condition coutners