Fix a bug when evaluating a periodic boundary condition for nonlinear ODEs.