Fixed bugs in FunctionSampler1D that could segfault and also cause more refinement than necessary.