Fix misbehaviors of grilio under some boundary conditions