small change to B-splines algorithm. still buggy though