fix boundary condition for exit