issue #4861, fixed some boundary conditions