Improved BasisFunction() algorithm to prevent division by zero.
Experiment with different knot vector filling algorithm.