Boundary condition bug fixed in implicit method