modified BVP_nl to be more flexible in boundary conditions