diff --git a/regtest/manyrestraints/rt53/deriv.reference b/regtest/manyrestraints/rt53/deriv.reference
index 57d4911611198793291d3b2a3ab25b0ad9137a4a..e4f7eb65d6c5436f55b96d6792b1d8b8f7364b0c 100644
--- a/regtest/manyrestraints/rt53/deriv.reference
+++ b/regtest/manyrestraints/rt53/deriv.reference
@@ -1,346 +1,361 @@
 #! FIELDS time parameter sr.bias srnum.bias
- 0.000000 0  -0.0006  -0.0006
- 0.000000 1   0.0017   0.0017
- 0.000000 2  -0.0038  -0.0038
- 0.000000 3  -0.0006  -0.0006
- 0.000000 4   0.0017   0.0017
- 0.000000 5  -0.0038  -0.0038
- 0.000000 6  -0.0006  -0.0006
- 0.000000 7   0.0017   0.0017
- 0.000000 8  -0.0038  -0.0038
- 0.000000 9  -0.0006  -0.0006
- 0.000000 10   0.0017   0.0017
- 0.000000 11  -0.0038  -0.0038
- 0.000000 12  -0.0006  -0.0006
- 0.000000 13   0.0017   0.0017
- 0.000000 14  -0.0038  -0.0038
- 0.000000 15  -0.0006  -0.0006
- 0.000000 16   0.0017   0.0017
- 0.000000 17  -0.0038  -0.0038
- 0.000000 18  -0.0006  -0.0006
- 0.000000 19   0.0017   0.0017
- 0.000000 20  -0.0038  -0.0038
- 0.000000 21  -0.0006  -0.0006
- 0.000000 22   0.0017   0.0017
- 0.000000 23  -0.0038  -0.0038
- 0.000000 24  -0.0006  -0.0006
- 0.000000 25   0.0017   0.0017
- 0.000000 26  -0.0038  -0.0038
- 0.000000 27   0.0106   0.0106
- 0.000000 28  -0.0318  -0.0318
- 0.000000 29   0.0716   0.0716
- 0.000000 30  -0.0006  -0.0006
- 0.000000 31   0.0017   0.0017
- 0.000000 32  -0.0038  -0.0038
- 0.000000 33  -0.0006  -0.0006
- 0.000000 34   0.0017   0.0017
- 0.000000 35  -0.0038  -0.0038
- 0.000000 36  -0.0006  -0.0006
- 0.000000 37   0.0017   0.0017
- 0.000000 38  -0.0038  -0.0038
- 0.000000 39  -0.0006  -0.0006
- 0.000000 40   0.0017   0.0017
- 0.000000 41  -0.0038  -0.0038
- 0.000000 42  -0.0006  -0.0006
- 0.000000 43   0.0017   0.0017
- 0.000000 44  -0.0038  -0.0038
- 0.000000 45  -0.0006  -0.0006
- 0.000000 46   0.0017   0.0017
- 0.000000 47  -0.0038  -0.0038
- 0.000000 48  -0.0006  -0.0006
- 0.000000 49   0.0017   0.0017
- 0.000000 50  -0.0038  -0.0038
- 0.000000 51  -0.0006  -0.0006
- 0.000000 52   0.0017   0.0017
- 0.000000 53  -0.0038  -0.0038
- 0.000000 54  -0.0006  -0.0006
- 0.000000 55   0.0017   0.0017
- 0.000000 56  -0.0038  -0.0038
- 0.000000 57  -0.0006  -0.0006
- 0.000000 58   0.0017   0.0017
- 0.000000 59  -0.0038  -0.0038
- 0.000000 60  -0.0040  -0.0040
- 0.000000 61   0.0121   0.0121
- 0.000000 62  -0.0273  -0.0273
- 0.000000 63   0.0121   0.0121
- 0.000000 64  -0.0365  -0.0365
- 0.000000 65   0.0821   0.0821
- 0.000000 66  -0.0273  -0.0273
- 0.000000 67   0.0821   0.0821
- 0.000000 68  -0.1850  -0.1850
- 0.050000 0  -0.0005  -0.0005
- 0.050000 1   0.0018   0.0018
- 0.050000 2  -0.0040  -0.0040
- 0.050000 3  -0.0005  -0.0005
- 0.050000 4   0.0018   0.0018
- 0.050000 5  -0.0040  -0.0040
- 0.050000 6  -0.0005  -0.0005
- 0.050000 7   0.0018   0.0018
- 0.050000 8  -0.0040  -0.0040
- 0.050000 9  -0.0005  -0.0005
- 0.050000 10   0.0018   0.0018
- 0.050000 11  -0.0040  -0.0040
- 0.050000 12  -0.0005  -0.0005
- 0.050000 13   0.0018   0.0018
- 0.050000 14  -0.0040  -0.0040
- 0.050000 15  -0.0005  -0.0005
- 0.050000 16   0.0018   0.0018
- 0.050000 17  -0.0040  -0.0040
- 0.050000 18  -0.0005  -0.0005
- 0.050000 19   0.0018   0.0018
- 0.050000 20  -0.0040  -0.0040
- 0.050000 21  -0.0005  -0.0005
- 0.050000 22   0.0018   0.0018
- 0.050000 23  -0.0040  -0.0040
- 0.050000 24  -0.0005  -0.0005
- 0.050000 25   0.0018   0.0018
- 0.050000 26  -0.0040  -0.0040
- 0.050000 27   0.0097   0.0097
- 0.050000 28  -0.0342  -0.0342
- 0.050000 29   0.0765   0.0765
- 0.050000 30  -0.0005  -0.0005
- 0.050000 31   0.0018   0.0018
- 0.050000 32  -0.0040  -0.0040
- 0.050000 33  -0.0005  -0.0005
- 0.050000 34   0.0018   0.0018
- 0.050000 35  -0.0040  -0.0040
- 0.050000 36  -0.0005  -0.0005
- 0.050000 37   0.0018   0.0018
- 0.050000 38  -0.0040  -0.0040
- 0.050000 39  -0.0005  -0.0005
- 0.050000 40   0.0018   0.0018
- 0.050000 41  -0.0040  -0.0040
- 0.050000 42  -0.0005  -0.0005
- 0.050000 43   0.0018   0.0018
- 0.050000 44  -0.0040  -0.0040
- 0.050000 45  -0.0005  -0.0005
- 0.050000 46   0.0018   0.0018
- 0.050000 47  -0.0040  -0.0040
- 0.050000 48  -0.0005  -0.0005
- 0.050000 49   0.0018   0.0018
- 0.050000 50  -0.0040  -0.0040
- 0.050000 51  -0.0005  -0.0005
- 0.050000 52   0.0018   0.0018
- 0.050000 53  -0.0040  -0.0040
- 0.050000 54  -0.0005  -0.0005
- 0.050000 55   0.0018   0.0018
- 0.050000 56  -0.0040  -0.0040
- 0.050000 57  -0.0005  -0.0005
- 0.050000 58   0.0018   0.0018
- 0.050000 59  -0.0040  -0.0040
- 0.050000 60  -0.0032  -0.0032
- 0.050000 61   0.0112   0.0112
- 0.050000 62  -0.0252  -0.0252
- 0.050000 63   0.0112   0.0112
- 0.050000 64  -0.0397  -0.0397
- 0.050000 65   0.0888   0.0888
- 0.050000 66  -0.0252  -0.0252
- 0.050000 67   0.0888   0.0888
- 0.050000 68  -0.1988  -0.1988
- 0.100000 0  -0.0004  -0.0004
- 0.100000 1   0.0018   0.0018
- 0.100000 2  -0.0040  -0.0040
- 0.100000 3  -0.0004  -0.0004
- 0.100000 4   0.0018   0.0018
- 0.100000 5  -0.0040  -0.0040
- 0.100000 6  -0.0004  -0.0004
- 0.100000 7   0.0018   0.0018
- 0.100000 8  -0.0040  -0.0040
- 0.100000 9  -0.0004  -0.0004
- 0.100000 10   0.0018   0.0018
- 0.100000 11  -0.0040  -0.0040
- 0.100000 12  -0.0004  -0.0004
- 0.100000 13   0.0018   0.0018
- 0.100000 14  -0.0040  -0.0040
- 0.100000 15  -0.0004  -0.0004
- 0.100000 16   0.0018   0.0018
- 0.100000 17  -0.0040  -0.0040
- 0.100000 18  -0.0004  -0.0004
- 0.100000 19   0.0018   0.0018
- 0.100000 20  -0.0040  -0.0040
- 0.100000 21  -0.0004  -0.0004
- 0.100000 22   0.0018   0.0018
- 0.100000 23  -0.0040  -0.0040
- 0.100000 24  -0.0004  -0.0004
- 0.100000 25   0.0018   0.0018
- 0.100000 26  -0.0040  -0.0040
- 0.100000 27   0.0077   0.0077
- 0.100000 28  -0.0343  -0.0343
- 0.100000 29   0.0757   0.0757
- 0.100000 30  -0.0004  -0.0004
- 0.100000 31   0.0018   0.0018
- 0.100000 32  -0.0040  -0.0040
- 0.100000 33  -0.0004  -0.0004
- 0.100000 34   0.0018   0.0018
- 0.100000 35  -0.0040  -0.0040
- 0.100000 36  -0.0004  -0.0004
- 0.100000 37   0.0018   0.0018
- 0.100000 38  -0.0040  -0.0040
- 0.100000 39  -0.0004  -0.0004
- 0.100000 40   0.0018   0.0018
- 0.100000 41  -0.0040  -0.0040
- 0.100000 42  -0.0004  -0.0004
- 0.100000 43   0.0018   0.0018
- 0.100000 44  -0.0040  -0.0040
- 0.100000 45  -0.0004  -0.0004
- 0.100000 46   0.0018   0.0018
- 0.100000 47  -0.0040  -0.0040
- 0.100000 48  -0.0004  -0.0004
- 0.100000 49   0.0018   0.0018
- 0.100000 50  -0.0040  -0.0040
- 0.100000 51  -0.0004  -0.0004
- 0.100000 52   0.0018   0.0018
- 0.100000 53  -0.0040  -0.0040
- 0.100000 54  -0.0004  -0.0004
- 0.100000 55   0.0018   0.0018
- 0.100000 56  -0.0040  -0.0040
- 0.100000 57  -0.0004  -0.0004
- 0.100000 58   0.0018   0.0018
- 0.100000 59  -0.0040  -0.0040
- 0.100000 60  -0.0020  -0.0020
- 0.100000 61   0.0090   0.0090
- 0.100000 62  -0.0199  -0.0199
- 0.100000 63   0.0090   0.0090
- 0.100000 64  -0.0404  -0.0404
- 0.100000 65   0.0890   0.0890
- 0.100000 66  -0.0199  -0.0199
- 0.100000 67   0.0890   0.0890
- 0.100000 68  -0.1964  -0.1964
- 0.150000 0  -0.0003  -0.0003
- 0.150000 1   0.0018   0.0018
- 0.150000 2  -0.0039  -0.0039
- 0.150000 3  -0.0003  -0.0003
- 0.150000 4   0.0018   0.0018
- 0.150000 5  -0.0039  -0.0039
- 0.150000 6  -0.0003  -0.0003
- 0.150000 7   0.0018   0.0018
- 0.150000 8  -0.0039  -0.0039
- 0.150000 9  -0.0003  -0.0003
- 0.150000 10   0.0018   0.0018
- 0.150000 11  -0.0039  -0.0039
- 0.150000 12  -0.0003  -0.0003
- 0.150000 13   0.0018   0.0018
- 0.150000 14  -0.0039  -0.0039
- 0.150000 15  -0.0003  -0.0003
- 0.150000 16   0.0018   0.0018
- 0.150000 17  -0.0039  -0.0039
- 0.150000 18  -0.0003  -0.0003
- 0.150000 19   0.0018   0.0018
- 0.150000 20  -0.0039  -0.0039
- 0.150000 21  -0.0003  -0.0003
- 0.150000 22   0.0018   0.0018
- 0.150000 23  -0.0039  -0.0039
- 0.150000 24  -0.0003  -0.0003
- 0.150000 25   0.0018   0.0018
- 0.150000 26  -0.0039  -0.0039
- 0.150000 27   0.0053   0.0053
- 0.150000 28  -0.0340  -0.0340
- 0.150000 29   0.0730   0.0730
- 0.150000 30  -0.0003  -0.0003
- 0.150000 31   0.0018   0.0018
- 0.150000 32  -0.0039  -0.0039
- 0.150000 33  -0.0004  -0.0004
- 0.150000 34   0.0017   0.0017
- 0.150000 35  -0.0030  -0.0030
- 0.150000 36  -0.0003  -0.0003
- 0.150000 37   0.0018   0.0018
- 0.150000 38  -0.0039  -0.0039
- 0.150000 39  -0.0003  -0.0003
- 0.150000 40   0.0018   0.0018
- 0.150000 41  -0.0039  -0.0039
- 0.150000 42  -0.0003  -0.0003
- 0.150000 43   0.0018   0.0018
- 0.150000 44  -0.0039  -0.0039
- 0.150000 45  -0.0003  -0.0003
- 0.150000 46   0.0018   0.0018
- 0.150000 47  -0.0039  -0.0039
- 0.150000 48  -0.0003  -0.0003
- 0.150000 49   0.0018   0.0018
- 0.150000 50  -0.0039  -0.0039
- 0.150000 51  -0.0003  -0.0003
- 0.150000 52   0.0018   0.0018
- 0.150000 53  -0.0039  -0.0039
- 0.150000 54  -0.0003  -0.0003
- 0.150000 55   0.0018   0.0018
- 0.150000 56  -0.0039  -0.0039
- 0.150000 57  -0.0003  -0.0003
- 0.150000 58   0.0018   0.0018
- 0.150000 59  -0.0039  -0.0039
- 0.150000 60  -0.0010  -0.0010
- 0.150000 61   0.0064   0.0064
- 0.150000 62  -0.0135  -0.0135
- 0.150000 63   0.0064   0.0064
- 0.150000 64  -0.0409  -0.0409
- 0.150000 65   0.0880   0.0880
- 0.150000 66  -0.0135  -0.0135
- 0.150000 67   0.0880   0.0880
- 0.150000 68  -0.1907  -0.1907
- 0.200000 0  -0.0002  -0.0002
- 0.200000 1   0.0017   0.0017
- 0.200000 2  -0.0037  -0.0037
- 0.200000 3  -0.0002  -0.0002
- 0.200000 4   0.0017   0.0017
- 0.200000 5  -0.0037  -0.0037
- 0.200000 6  -0.0002  -0.0002
- 0.200000 7   0.0017   0.0017
- 0.200000 8  -0.0037  -0.0037
- 0.200000 9  -0.0002  -0.0002
- 0.200000 10   0.0017   0.0017
- 0.200000 11  -0.0037  -0.0037
- 0.200000 12  -0.0002  -0.0002
- 0.200000 13   0.0017   0.0017
- 0.200000 14  -0.0037  -0.0037
- 0.200000 15  -0.0002  -0.0002
- 0.200000 16   0.0017   0.0017
- 0.200000 17  -0.0037  -0.0037
- 0.200000 18  -0.0002  -0.0002
- 0.200000 19   0.0017   0.0017
- 0.200000 20  -0.0037  -0.0037
- 0.200000 21  -0.0002  -0.0002
- 0.200000 22   0.0017   0.0017
- 0.200000 23  -0.0037  -0.0037
- 0.200000 24  -0.0002  -0.0002
- 0.200000 25   0.0017   0.0017
- 0.200000 26  -0.0037  -0.0037
- 0.200000 27   0.0032   0.0032
- 0.200000 28  -0.0327  -0.0327
- 0.200000 29   0.0688   0.0688
- 0.200000 30  -0.0002  -0.0002
- 0.200000 31   0.0017   0.0017
- 0.200000 32  -0.0037  -0.0037
- 0.200000 33  -0.0004  -0.0004
- 0.200000 34   0.0015   0.0015
- 0.200000 35  -0.0015  -0.0015
- 0.200000 36  -0.0002  -0.0002
- 0.200000 37   0.0017   0.0017
- 0.200000 38  -0.0037  -0.0037
- 0.200000 39  -0.0002  -0.0002
- 0.200000 40   0.0017   0.0017
- 0.200000 41  -0.0037  -0.0037
- 0.200000 42  -0.0002  -0.0002
- 0.200000 43   0.0017   0.0017
- 0.200000 44  -0.0037  -0.0037
- 0.200000 45  -0.0002  -0.0002
- 0.200000 46   0.0017   0.0017
- 0.200000 47  -0.0037  -0.0037
- 0.200000 48  -0.0002  -0.0002
- 0.200000 49   0.0017   0.0017
- 0.200000 50  -0.0037  -0.0037
- 0.200000 51  -0.0002  -0.0002
- 0.200000 52   0.0017   0.0017
- 0.200000 53  -0.0037  -0.0037
- 0.200000 54  -0.0002  -0.0002
- 0.200000 55   0.0017   0.0017
- 0.200000 56  -0.0037  -0.0037
- 0.200000 57  -0.0002  -0.0002
- 0.200000 58   0.0017   0.0017
- 0.200000 59  -0.0037  -0.0037
- 0.200000 60  -0.0004  -0.0004
- 0.200000 61   0.0038   0.0038
- 0.200000 62  -0.0075  -0.0075
- 0.200000 63   0.0038   0.0038
- 0.200000 64  -0.0398  -0.0398
- 0.200000 65   0.0844   0.0844
- 0.200000 66  -0.0075  -0.0075
- 0.200000 67   0.0844   0.0844
- 0.200000 68  -0.1826  -0.1826
+ 0.000000 0  -0.0111  -0.0111
+ 0.000000 1   0.0335   0.0335
+ 0.000000 2  -0.0754  -0.0754
+ 0.000000 3   0.0000   0.0000
+ 0.000000 4   0.0000   0.0000
+ 0.000000 5   0.0000   0.0000
+ 0.000000 6   0.0000   0.0000
+ 0.000000 7   0.0000   0.0000
+ 0.000000 8   0.0000   0.0000
+ 0.000000 9   0.0000   0.0000
+ 0.000000 10   0.0000   0.0000
+ 0.000000 11   0.0000   0.0000
+ 0.000000 12   0.0000   0.0000
+ 0.000000 13   0.0000   0.0000
+ 0.000000 14   0.0000   0.0000
+ 0.000000 15   0.0000   0.0000
+ 0.000000 16   0.0000   0.0000
+ 0.000000 17   0.0000   0.0000
+ 0.000000 18   0.0000   0.0000
+ 0.000000 19   0.0000   0.0000
+ 0.000000 20   0.0000   0.0000
+ 0.000000 21   0.0000   0.0000
+ 0.000000 22   0.0000   0.0000
+ 0.000000 23   0.0000   0.0000
+ 0.000000 24   0.0000   0.0000
+ 0.000000 25   0.0000   0.0000
+ 0.000000 26   0.0000   0.0000
+ 0.000000 27   0.0000   0.0000
+ 0.000000 28   0.0000   0.0000
+ 0.000000 29   0.0000   0.0000
+ 0.000000 30   0.0111   0.0111
+ 0.000000 31  -0.0335  -0.0335
+ 0.000000 32   0.0754   0.0754
+ 0.000000 33   0.0000   0.0000
+ 0.000000 34   0.0000   0.0000
+ 0.000000 35   0.0000   0.0000
+ 0.000000 36   0.0000   0.0000
+ 0.000000 37   0.0000   0.0000
+ 0.000000 38   0.0000   0.0000
+ 0.000000 39   0.0000   0.0000
+ 0.000000 40   0.0000   0.0000
+ 0.000000 41   0.0000   0.0000
+ 0.000000 42   0.0000   0.0000
+ 0.000000 43   0.0000   0.0000
+ 0.000000 44   0.0000   0.0000
+ 0.000000 45   0.0000   0.0000
+ 0.000000 46   0.0000   0.0000
+ 0.000000 47   0.0000   0.0000
+ 0.000000 48   0.0000   0.0000
+ 0.000000 49   0.0000   0.0000
+ 0.000000 50   0.0000   0.0000
+ 0.000000 51   0.0000   0.0000
+ 0.000000 52   0.0000   0.0000
+ 0.000000 53   0.0000   0.0000
+ 0.000000 54   0.0000   0.0000
+ 0.000000 55   0.0000   0.0000
+ 0.000000 56   0.0000   0.0000
+ 0.000000 57   0.0000   0.0000
+ 0.000000 58   0.0000   0.0000
+ 0.000000 59   0.0000   0.0000
+ 0.000000 60   0.0000   0.0000
+ 0.000000 61   0.0000   0.0000
+ 0.000000 62   0.0000   0.0000
+ 0.000000 63  -0.0040  -0.0040
+ 0.000000 64   0.0121   0.0121
+ 0.000000 65  -0.0273  -0.0273
+ 0.000000 66   0.0121   0.0121
+ 0.000000 67  -0.0365  -0.0365
+ 0.000000 68   0.0821   0.0821
+ 0.000000 69  -0.0273  -0.0273
+ 0.000000 70   0.0821   0.0821
+ 0.000000 71  -0.1850  -0.1850
+ 0.050000 0  -0.0102  -0.0102
+ 0.050000 1   0.0360   0.0360
+ 0.050000 2  -0.0805  -0.0805
+ 0.050000 3   0.0000   0.0000
+ 0.050000 4   0.0000   0.0000
+ 0.050000 5   0.0000   0.0000
+ 0.050000 6   0.0000   0.0000
+ 0.050000 7   0.0000   0.0000
+ 0.050000 8   0.0000   0.0000
+ 0.050000 9   0.0000   0.0000
+ 0.050000 10   0.0000   0.0000
+ 0.050000 11   0.0000   0.0000
+ 0.050000 12   0.0000   0.0000
+ 0.050000 13   0.0000   0.0000
+ 0.050000 14   0.0000   0.0000
+ 0.050000 15   0.0000   0.0000
+ 0.050000 16   0.0000   0.0000
+ 0.050000 17   0.0000   0.0000
+ 0.050000 18   0.0000   0.0000
+ 0.050000 19   0.0000   0.0000
+ 0.050000 20   0.0000   0.0000
+ 0.050000 21   0.0000   0.0000
+ 0.050000 22   0.0000   0.0000
+ 0.050000 23   0.0000   0.0000
+ 0.050000 24   0.0000   0.0000
+ 0.050000 25   0.0000   0.0000
+ 0.050000 26   0.0000   0.0000
+ 0.050000 27   0.0000   0.0000
+ 0.050000 28   0.0000   0.0000
+ 0.050000 29   0.0000   0.0000
+ 0.050000 30   0.0102   0.0102
+ 0.050000 31  -0.0360  -0.0360
+ 0.050000 32   0.0805   0.0805
+ 0.050000 33   0.0000   0.0000
+ 0.050000 34   0.0000   0.0000
+ 0.050000 35   0.0000   0.0000
+ 0.050000 36   0.0000   0.0000
+ 0.050000 37   0.0000   0.0000
+ 0.050000 38   0.0000   0.0000
+ 0.050000 39   0.0000   0.0000
+ 0.050000 40   0.0000   0.0000
+ 0.050000 41   0.0000   0.0000
+ 0.050000 42   0.0000   0.0000
+ 0.050000 43   0.0000   0.0000
+ 0.050000 44   0.0000   0.0000
+ 0.050000 45   0.0000   0.0000
+ 0.050000 46   0.0000   0.0000
+ 0.050000 47   0.0000   0.0000
+ 0.050000 48   0.0000   0.0000
+ 0.050000 49   0.0000   0.0000
+ 0.050000 50   0.0000   0.0000
+ 0.050000 51   0.0000   0.0000
+ 0.050000 52   0.0000   0.0000
+ 0.050000 53   0.0000   0.0000
+ 0.050000 54   0.0000   0.0000
+ 0.050000 55   0.0000   0.0000
+ 0.050000 56   0.0000   0.0000
+ 0.050000 57   0.0000   0.0000
+ 0.050000 58   0.0000   0.0000
+ 0.050000 59   0.0000   0.0000
+ 0.050000 60   0.0000   0.0000
+ 0.050000 61   0.0000   0.0000
+ 0.050000 62   0.0000   0.0000
+ 0.050000 63  -0.0032  -0.0032
+ 0.050000 64   0.0112   0.0112
+ 0.050000 65  -0.0252  -0.0252
+ 0.050000 66   0.0112   0.0112
+ 0.050000 67  -0.0397  -0.0397
+ 0.050000 68   0.0888   0.0888
+ 0.050000 69  -0.0252  -0.0252
+ 0.050000 70   0.0888   0.0888
+ 0.050000 71  -0.1988  -0.1988
+ 0.100000 0  -0.0081  -0.0081
+ 0.100000 1   0.0361   0.0361
+ 0.100000 2  -0.0796  -0.0796
+ 0.100000 3   0.0000   0.0000
+ 0.100000 4   0.0000   0.0000
+ 0.100000 5   0.0000   0.0000
+ 0.100000 6   0.0000   0.0000
+ 0.100000 7   0.0000   0.0000
+ 0.100000 8   0.0000   0.0000
+ 0.100000 9   0.0000   0.0000
+ 0.100000 10   0.0000   0.0000
+ 0.100000 11   0.0000   0.0000
+ 0.100000 12   0.0000   0.0000
+ 0.100000 13   0.0000   0.0000
+ 0.100000 14   0.0000   0.0000
+ 0.100000 15   0.0000   0.0000
+ 0.100000 16   0.0000   0.0000
+ 0.100000 17   0.0000   0.0000
+ 0.100000 18   0.0000   0.0000
+ 0.100000 19   0.0000   0.0000
+ 0.100000 20   0.0000   0.0000
+ 0.100000 21   0.0000   0.0000
+ 0.100000 22   0.0000   0.0000
+ 0.100000 23   0.0000   0.0000
+ 0.100000 24   0.0000   0.0000
+ 0.100000 25   0.0000   0.0000
+ 0.100000 26   0.0000   0.0000
+ 0.100000 27   0.0000   0.0000
+ 0.100000 28   0.0000   0.0000
+ 0.100000 29   0.0000   0.0000
+ 0.100000 30   0.0081   0.0081
+ 0.100000 31  -0.0361  -0.0361
+ 0.100000 32   0.0796   0.0796
+ 0.100000 33   0.0000   0.0000
+ 0.100000 34   0.0000   0.0000
+ 0.100000 35   0.0000   0.0000
+ 0.100000 36   0.0000   0.0000
+ 0.100000 37   0.0000   0.0000
+ 0.100000 38   0.0000   0.0000
+ 0.100000 39   0.0000   0.0000
+ 0.100000 40   0.0000   0.0000
+ 0.100000 41   0.0000   0.0000
+ 0.100000 42   0.0000   0.0000
+ 0.100000 43   0.0000   0.0000
+ 0.100000 44   0.0000   0.0000
+ 0.100000 45   0.0000   0.0000
+ 0.100000 46   0.0000   0.0000
+ 0.100000 47   0.0000   0.0000
+ 0.100000 48   0.0000   0.0000
+ 0.100000 49   0.0000   0.0000
+ 0.100000 50   0.0000   0.0000
+ 0.100000 51   0.0000   0.0000
+ 0.100000 52   0.0000   0.0000
+ 0.100000 53   0.0000   0.0000
+ 0.100000 54   0.0000   0.0000
+ 0.100000 55   0.0000   0.0000
+ 0.100000 56   0.0000   0.0000
+ 0.100000 57   0.0000   0.0000
+ 0.100000 58   0.0000   0.0000
+ 0.100000 59   0.0000   0.0000
+ 0.100000 60   0.0000   0.0000
+ 0.100000 61   0.0000   0.0000
+ 0.100000 62   0.0000   0.0000
+ 0.100000 63  -0.0020  -0.0020
+ 0.100000 64   0.0090   0.0090
+ 0.100000 65  -0.0199  -0.0199
+ 0.100000 66   0.0090   0.0090
+ 0.100000 67  -0.0404  -0.0404
+ 0.100000 68   0.0890   0.0890
+ 0.100000 69  -0.0199  -0.0199
+ 0.100000 70   0.0890   0.0890
+ 0.100000 71  -0.1964  -0.1964
+ 0.150000 0  -0.0055  -0.0055
+ 0.150000 1   0.0358   0.0358
+ 0.150000 2  -0.0777  -0.0777
+ 0.150000 3   0.0000   0.0000
+ 0.150000 4   0.0000   0.0000
+ 0.150000 5   0.0000   0.0000
+ 0.150000 6   0.0000   0.0000
+ 0.150000 7   0.0000   0.0000
+ 0.150000 8   0.0000   0.0000
+ 0.150000 9   0.0000   0.0000
+ 0.150000 10   0.0000   0.0000
+ 0.150000 11   0.0000   0.0000
+ 0.150000 12   0.0000   0.0000
+ 0.150000 13   0.0000   0.0000
+ 0.150000 14   0.0000   0.0000
+ 0.150000 15   0.0000   0.0000
+ 0.150000 16   0.0000   0.0000
+ 0.150000 17   0.0000   0.0000
+ 0.150000 18   0.0000   0.0000
+ 0.150000 19   0.0000   0.0000
+ 0.150000 20   0.0000   0.0000
+ 0.150000 21   0.0000   0.0000
+ 0.150000 22   0.0000   0.0000
+ 0.150000 23   0.0000   0.0000
+ 0.150000 24   0.0000   0.0000
+ 0.150000 25   0.0000   0.0000
+ 0.150000 26   0.0000   0.0000
+ 0.150000 27   0.0000   0.0000
+ 0.150000 28   0.0000   0.0000
+ 0.150000 29   0.0000   0.0000
+ 0.150000 30   0.0056   0.0056
+ 0.150000 31  -0.0358  -0.0358
+ 0.150000 32   0.0769   0.0769
+ 0.150000 33   0.0000   0.0000
+ 0.150000 34   0.0000   0.0000
+ 0.150000 35   0.0000   0.0000
+ 0.150000 36  -0.0001  -0.0001
+ 0.150000 37  -0.0001  -0.0001
+ 0.150000 38   0.0008   0.0008
+ 0.150000 39   0.0000   0.0000
+ 0.150000 40   0.0000   0.0000
+ 0.150000 41   0.0000   0.0000
+ 0.150000 42   0.0000   0.0000
+ 0.150000 43   0.0000   0.0000
+ 0.150000 44   0.0000   0.0000
+ 0.150000 45   0.0000   0.0000
+ 0.150000 46   0.0000   0.0000
+ 0.150000 47   0.0000   0.0000
+ 0.150000 48   0.0000   0.0000
+ 0.150000 49   0.0000   0.0000
+ 0.150000 50   0.0000   0.0000
+ 0.150000 51   0.0000   0.0000
+ 0.150000 52   0.0000   0.0000
+ 0.150000 53   0.0000   0.0000
+ 0.150000 54   0.0000   0.0000
+ 0.150000 55   0.0000   0.0000
+ 0.150000 56   0.0000   0.0000
+ 0.150000 57   0.0000   0.0000
+ 0.150000 58   0.0000   0.0000
+ 0.150000 59   0.0000   0.0000
+ 0.150000 60   0.0000   0.0000
+ 0.150000 61   0.0000   0.0000
+ 0.150000 62   0.0000   0.0000
+ 0.150000 63  -0.0010  -0.0010
+ 0.150000 64   0.0064   0.0064
+ 0.150000 65  -0.0135  -0.0135
+ 0.150000 66   0.0064   0.0064
+ 0.150000 67  -0.0409  -0.0409
+ 0.150000 68   0.0880   0.0880
+ 0.150000 69  -0.0135  -0.0135
+ 0.150000 70   0.0880   0.0880
+ 0.150000 71  -0.1907  -0.1907
+ 0.200000 0  -0.0031  -0.0031
+ 0.200000 1   0.0346   0.0346
+ 0.200000 2  -0.0749  -0.0749
+ 0.200000 3   0.0000   0.0000
+ 0.200000 4   0.0000   0.0000
+ 0.200000 5   0.0000   0.0000
+ 0.200000 6   0.0000   0.0000
+ 0.200000 7   0.0000   0.0000
+ 0.200000 8   0.0000   0.0000
+ 0.200000 9   0.0000   0.0000
+ 0.200000 10   0.0000   0.0000
+ 0.200000 11   0.0000   0.0000
+ 0.200000 12   0.0000   0.0000
+ 0.200000 13   0.0000   0.0000
+ 0.200000 14   0.0000   0.0000
+ 0.200000 15   0.0000   0.0000
+ 0.200000 16   0.0000   0.0000
+ 0.200000 17   0.0000   0.0000
+ 0.200000 18   0.0000   0.0000
+ 0.200000 19   0.0000   0.0000
+ 0.200000 20   0.0000   0.0000
+ 0.200000 21   0.0000   0.0000
+ 0.200000 22   0.0000   0.0000
+ 0.200000 23   0.0000   0.0000
+ 0.200000 24   0.0000   0.0000
+ 0.200000 25   0.0000   0.0000
+ 0.200000 26   0.0000   0.0000
+ 0.200000 27   0.0000   0.0000
+ 0.200000 28   0.0000   0.0000
+ 0.200000 29   0.0000   0.0000
+ 0.200000 30   0.0033   0.0033
+ 0.200000 31  -0.0344  -0.0344
+ 0.200000 32   0.0726   0.0726
+ 0.200000 33   0.0000   0.0000
+ 0.200000 34   0.0000   0.0000
+ 0.200000 35   0.0000   0.0000
+ 0.200000 36  -0.0003  -0.0003
+ 0.200000 37  -0.0002  -0.0002
+ 0.200000 38   0.0023   0.0023
+ 0.200000 39   0.0000   0.0000
+ 0.200000 40   0.0000   0.0000
+ 0.200000 41   0.0000   0.0000
+ 0.200000 42   0.0000   0.0000
+ 0.200000 43   0.0000   0.0000
+ 0.200000 44   0.0000   0.0000
+ 0.200000 45   0.0000   0.0000
+ 0.200000 46   0.0000   0.0000
+ 0.200000 47   0.0000   0.0000
+ 0.200000 48   0.0000   0.0000
+ 0.200000 49   0.0000   0.0000
+ 0.200000 50   0.0000   0.0000
+ 0.200000 51   0.0000   0.0000
+ 0.200000 52   0.0000   0.0000
+ 0.200000 53   0.0000   0.0000
+ 0.200000 54   0.0000   0.0000
+ 0.200000 55   0.0000   0.0000
+ 0.200000 56   0.0000   0.0000
+ 0.200000 57   0.0000   0.0000
+ 0.200000 58   0.0000   0.0000
+ 0.200000 59   0.0000   0.0000
+ 0.200000 60   0.0000   0.0000
+ 0.200000 61   0.0000   0.0000
+ 0.200000 62   0.0000   0.0000
+ 0.200000 63  -0.0004  -0.0004
+ 0.200000 64   0.0038   0.0038
+ 0.200000 65  -0.0075  -0.0075
+ 0.200000 66   0.0038   0.0038
+ 0.200000 67  -0.0398  -0.0398
+ 0.200000 68   0.0844   0.0844
+ 0.200000 69  -0.0075  -0.0075
+ 0.200000 70   0.0844   0.0844
+ 0.200000 71  -0.1826  -0.1826
diff --git a/regtest/manyrestraints/rt53/plumed.dat b/regtest/manyrestraints/rt53/plumed.dat
index 5402b6e464ac51b1bca70db85d3ad7a4833c0b68..943997d3963f510743ff6717669e73c0c1897dff 100644
--- a/regtest/manyrestraints/rt53/plumed.dat
+++ b/regtest/manyrestraints/rt53/plumed.dat
@@ -1,4 +1,7 @@
-SPHERICAL_RESTRAINT ATOMS=1-20 RADIUS=2.5 KAPPA=0.2 LABEL=sr
-SPHERICAL_RESTRAINT ATOMS=1-20 RADIUS=2.5 KAPPA=0.2 NUMERICAL_DERIVATIVES LABEL=srnum
+COM ATOMS=1-20 LABEL=c1
+DISTANCES GROUPA=c1 GROUPB=1-20 LABEL=d1
+UWALLS DATA=d1 AT=2.5 KAPPA=0.2 LABEL=sr
+UWALLS DATA=d1 AT=2.5 KAPPA=0.2 NUMERICAL_DERIVATIVES LABEL=srnum
+
 PRINT ARG=sr.bias FILE=colvar FMT=%8.4f
 DUMPDERIVATIVES ARG=sr.bias,srnum.bias FILE=deriv FMT=%8.4f
diff --git a/src/crystallization/VectorMultiColvar.cpp b/src/crystallization/VectorMultiColvar.cpp
index a165d1f2fdb2e859422e57eb9a1d9642c4ca73c9..ec5a61808570135fab622dd01f65c80bfba1e0af 100644
--- a/src/crystallization/VectorMultiColvar.cpp
+++ b/src/crystallization/VectorMultiColvar.cpp
@@ -120,7 +120,7 @@ vesselbase::StoreDataVessel* VectorMultiColvar::buildDataStashes(){
 }
 
 void VectorMultiColvar::getValueForTask( const unsigned& iatom, std::vector<double>& vals ){
-  plumed_dbg_assert( vecs && vals.size()==(getNumberOfQuantities-4) ); 
+  plumed_dbg_assert( vecs && vals.size()==(getNumberOfQuantities()-4) ); 
   MultiColvarBase::getValueForTask( iatom, vv1 ); vecs->getVector( iatom, vv2 );
   vals[0]=vv1[0]; for(unsigned i=0;i<vv2.size();++i) vals[i+1]=vv2[i];
 }
diff --git a/src/manyrestraints/ManyRestraintsBase.cpp b/src/manyrestraints/ManyRestraintsBase.cpp
index 745b7ab53fcb93e2ab6488f2bccae62937c40ef5..2a37fbb282d0ff769c3c0a16c5cc870d6f8ccd1b 100644
--- a/src/manyrestraints/ManyRestraintsBase.cpp
+++ b/src/manyrestraints/ManyRestraintsBase.cpp
@@ -28,8 +28,8 @@ namespace manyrestraints {
 void ManyRestraintsBase::registerKeywords( Keywords& keys ){
   Action::registerKeywords( keys );
   ActionWithValue::registerKeywords( keys );
-  ActionAtomistic::registerKeywords( keys );
   ActionWithVessel::registerKeywords( keys );
+  ActionWithInputVessel::registerKeywords( keys );
   ActionPilot::registerKeywords( keys );
   keys.add("hidden","STRIDE","the frequency with which the forces due to the bias should be calculated.  This can be used to correctly set up multistep algorithms");
   keys.remove("TOL");
@@ -37,30 +37,47 @@ void ManyRestraintsBase::registerKeywords( Keywords& keys ){
 
 ManyRestraintsBase::ManyRestraintsBase(const ActionOptions& ao):
 Action(ao),
-ActionAtomistic(ao),
 ActionWithValue(ao),
 ActionPilot(ao),
-ActionWithVessel(ao)
+ActionWithVessel(ao),
+ActionWithInputVessel(ao)
 {
+  // Read in the vessel we are action on
+  readArgument("bridge");
+  aves=dynamic_cast<ActionWithVessel*>( getDependencies()[0] );
+  plumed_assert( getDependencies().size()==1 && aves );
+  log.printf("  adding restraints on variables calculated by %s action with label %s\n",
+         aves->getName().c_str(),aves->getLabel().c_str());
+
+  // And turn on the derivatives (note problems here because of ActionWithValue)
+  turnOnDerivatives(); needsDerivatives();
+
+  // Now create the vessel
+  std::string fake_input="LABEL=bias";
+  addVessel( "SUM", fake_input, 0 ); 
+  readVesselKeywords();
 }
 
-void ManyRestraintsBase::turnOnDerivatives(){
-  error("restraints cannot be used as collective variables");
+void ManyRestraintsBase::doJobsRequiredBeforeTaskList(){
+  ActionWithVessel::doJobsRequiredBeforeTaskList();
+  ActionWithValue::clearDerivatives();
 }
 
-void ManyRestraintsBase::createRestraints( const unsigned& nrestraints ){
-  std::string fake_input; 
-  for(unsigned i=0;i<nrestraints;++i) addTaskToList(i);
-  addVessel( "SUM", fake_input, 0, "bias" );
-  readVesselKeywords();
-  forcesToApply.resize( getNumberOfDerivatives() );
+void ManyRestraintsBase::applyChainRuleForDerivatives( const double& df ){
+   // Value (this could be optimized more -- GAT)
+   for(unsigned i=0;i<aves->getNumberOfDerivatives();++i){
+       setElementDerivative( i, df*aves->getElementDerivative(i) );   
+   }
+   // And weights
+   unsigned nder=aves->getNumberOfDerivatives();
+   for(unsigned i=0;i<aves->getNumberOfDerivatives();++i){
+       setElementDerivative( nder+i, aves->getElementDerivative(nder+i) );
+   }
 }
 
 void ManyRestraintsBase::apply(){
   plumed_dbg_assert( getNumberOfComponents()==1 );
-  getPntrToComponent(0)->addForce(-1.0);
-  bool wasforced=getForcesFromVessels( forcesToApply );
-  plumed_assert( wasforced ); setForcesOnAtoms( forcesToApply );
+  getPntrToComponent(0)->addForce( -1.0*getStride() );
 }
 
 }
diff --git a/src/manyrestraints/ManyRestraintsBase.h b/src/manyrestraints/ManyRestraintsBase.h
index 9f116aa024412cf24926f1cc5062f1abd34c71d2..612f2327af8d3a75f0765ed3611c6b7e85a38dea 100644
--- a/src/manyrestraints/ManyRestraintsBase.h
+++ b/src/manyrestraints/ManyRestraintsBase.h
@@ -26,59 +26,59 @@
 #include "core/ActionWithValue.h"
 #include "core/ActionPilot.h"
 #include "vesselbase/ActionWithVessel.h"
+#include "vesselbase/ActionWithInputVessel.h"
 
 namespace PLMD {
 namespace manyrestraints {
 
 class ManyRestraintsBase :
- public ActionAtomistic,
  public ActionWithValue,
  public ActionPilot,
- public vesselbase::ActionWithVessel
+ public vesselbase::ActionWithVessel,
+ public vesselbase::ActionWithInputVessel
 {
 private:
-  std::vector<double> forcesToApply;
+/// Pointer to underlying action with vessel
+  vesselbase::ActionWithVessel* aves;
 protected:
-  void createRestraints( const unsigned& nrestraints );
-/// Add some derivatives to a particular atom
-  void addAtomsDerivatives(const int&,const Vector&);
-/// Add some derivatives to the virial
-  void addBoxDerivatives(const Tensor&);
+/// Get the value of the current cv
+  double getValue();
+/// Get the weight of the current cv
+  double getWeight();
+/// Apply the chain rule to calculate the derivatives
+  void applyChainRuleForDerivatives( const double& df );
 public:
   static void registerKeywords( Keywords& keys );
   ManyRestraintsBase(const ActionOptions&);
-  void turnOnDerivatives();
+  bool isPeriodic(){ return false; }
   unsigned getNumberOfDerivatives();
+/// Routines that have to be defined so as not to have problems with virtual methods
+  void deactivate_task(){};
+/// Don't actually clear the derivatives when this is called from plumed main.  
+/// They are calculated inside another action and clearing them would be bad  
+  void clearDerivatives(){}
+/// Do jobs required before tasks are undertaken
+  void doJobsRequiredBeforeTaskList();
+// Calculate does nothing
+  void calculate(){};
 /// Deactivate task now does nothing
-  void deactivate_task(){}
   void apply();
+  void applyBridgeForces( const std::vector<double>& bb ){ plumed_assert( bb.size()==0 ); }
 };
 
 inline
 unsigned ManyRestraintsBase::getNumberOfDerivatives(){
-  return 3*getNumberOfAtoms() + 9;
+  return aves->getNumberOfDerivatives();
 }
 
 inline
-void ManyRestraintsBase::addAtomsDerivatives(const int& iatom, const Vector& der){
-  plumed_dbg_assert( iatom<getNumberOfAtoms() );
-  addElementDerivative( 3*iatom+0, der[0] );
-  addElementDerivative( 3*iatom+1, der[1] );
-  addElementDerivative( 3*iatom+2, der[2] );
+double ManyRestraintsBase::getValue(){
+  return aves->getElementValue(0);
 }
-  
+
 inline
-void ManyRestraintsBase::addBoxDerivatives(const Tensor& vir){
-  int natoms=getNumberOfAtoms();
-  addElementDerivative( 3*natoms+0, vir(0,0) );
-  addElementDerivative( 3*natoms+1, vir(0,1) );
-  addElementDerivative( 3*natoms+2, vir(0,2) );
-  addElementDerivative( 3*natoms+3, vir(1,0) );
-  addElementDerivative( 3*natoms+4, vir(1,1) );
-  addElementDerivative( 3*natoms+5, vir(1,2) );
-  addElementDerivative( 3*natoms+6, vir(2,0) );
-  addElementDerivative( 3*natoms+7, vir(2,1) );
-  addElementDerivative( 3*natoms+8, vir(2,2) );
+double ManyRestraintsBase::getWeight(){
+  return aves->getElementValue(1);
 }
 
 }
diff --git a/src/manyrestraints/Sphere.cpp b/src/manyrestraints/UWalls.cpp
similarity index 53%
rename from src/manyrestraints/Sphere.cpp
rename to src/manyrestraints/UWalls.cpp
index a97ab3a8c85debbcb960e56a391de77bdc4a6c2d..9a278140ffa2502a6fe5d4177652ae141bfe7762 100644
--- a/src/manyrestraints/Sphere.cpp
+++ b/src/manyrestraints/UWalls.cpp
@@ -25,98 +25,54 @@
 namespace PLMD {
 namespace manyrestraints {
 
-class Sphere : public ManyRestraintsBase {
+class UWalls : public ManyRestraintsBase {
 private:
   double at;
   double kappa;
   double exp;
   double eps;
   double offset;
-  bool nopbc;
-  Vector com;
-  std::vector<double> com_deriv;
 public:
   static void registerKeywords( Keywords& keys );
-  Sphere( const ActionOptions& );
-  bool isPeriodic(){ return false; }
+  UWalls( const ActionOptions& );
   void performTask();
-  void calculate();
 };
 
-PLUMED_REGISTER_ACTION(Sphere,"SPHERICAL_RESTRAINT")
+PLUMED_REGISTER_ACTION(UWalls,"UWALLS")
 
-void Sphere::registerKeywords( Keywords& keys ){
+void UWalls::registerKeywords( Keywords& keys ){
   ManyRestraintsBase::registerKeywords( keys );
-  keys.add("atoms","ATOMS","the atoms that are being confined to the sphere");
-  keys.add("compulsory","RADIUS","the radius of the sphere");
+  keys.add("compulsory","AT","the radius of the sphere");
   keys.add("compulsory","KAPPA","the force constant for the wall.  The k_i in the expression for a wall.");
   keys.add("compulsory","OFFSET","0.0","the offset for the start of the wall.  The o_i in the expression for a wall.");
   keys.add("compulsory","EXP","2.0","the powers for the walls.  The e_i in the expression for a wall.");
   keys.add("compulsory","EPS","1.0","the values for s_i in the expression for a wall");
-  keys.addFlag("NOPBC",false,"turn off periodic boundary conditions");
 }
 
-Sphere::Sphere(const ActionOptions& ao):
+UWalls::UWalls(const ActionOptions& ao):
 Action(ao),
 ManyRestraintsBase(ao)
 {
-  std::vector<AtomNumber> atoms;
-  parseAtomList("ATOMS",atoms);
-  com_deriv.resize( atoms.size() );
-
-  parse("RADIUS",at);
+  parse("AT",at);
   parse("OFFSET",offset);
   parse("EPS",eps);
   parse("EXP",exp);
   parse("KAPPA",kappa);
-  parseFlag("NOPBC",nopbc);
   checkRead();
-
-  requestAtoms( atoms ); 
-  createRestraints( atoms.size() );
-}
-
-void Sphere::calculate(){
-  // Calculate position of the center of mass
-  double mass=0; com.zero();
-  for(unsigned i=0;i<getNumberOfAtoms();i++) mass+=getMass(i);
-
-  for(unsigned i=0;i<getNumberOfAtoms();i++){
-    com+=(getMass(i)/mass)*getPosition(i);
-    com_deriv[i]=(getMass(i)/mass);
-  }
- 
-  // Now run the full set of tasks
-  runAllTasks();
 }
 
-void Sphere::performTask(){
-  Vector distance;
-
-  if(!nopbc){
-    distance=pbcDistance(com,getPosition( getCurrentTask() ));
-  } else {
-    distance=delta(com,getPosition( getCurrentTask() ));
-  }
-
-  double value=distance.modulo();
+void UWalls::performTask(){
+  double value=getValue(); 
   double uscale = (value - at + offset)/eps;
   if( uscale > 0. ){
-     double invvalue= 1.0 / value ;
+     double invvalue= 1.0 / value;
      double power = pow( uscale, exp );
-     double f = invvalue * ( kappa / eps ) * exp * power / uscale;
-
-     setElementValue( 0, kappa*power ); setElementValue( 1, 1.0 );
-     // Add derivatives for com
-     for(unsigned i=0;i<getNumberOfAtoms();++i) addAtomsDerivatives( i, -com_deriv[i]*f*distance );
-
-     // Add derivatives for other atom 
-     addAtomsDerivatives( getCurrentTask(), f*distance );
-
-     // Add derivatives for virial
-     addBoxDerivatives( -f*Tensor(distance,distance) );
+     double f = ( kappa / eps ) * exp * power / uscale;
 
-     // We need to accumulate derivatives
+     setElementValue( 0, kappa*power ); setElementValue( 1, getWeight() );
+     // Add derivatives 
+     applyChainRuleForDerivatives( f );
+    
      return;
   }
 
diff --git a/src/multicolvar/MultiColvarFunction.h b/src/multicolvar/MultiColvarFunction.h
index 95539270d86e596db6c78e9e83b13c6eddbc18e4..5d54d63b143e21da84ddb9d6497c073db08d8658 100644
--- a/src/multicolvar/MultiColvarFunction.h
+++ b/src/multicolvar/MultiColvarFunction.h
@@ -178,7 +178,7 @@ void MultiColvarFunction::getValueForBaseTask( const unsigned& iatom, std::vecto
 
 inline
 void MultiColvarFunction::getVectorForBaseTask( const unsigned& iatom, std::vector<double>& vec ){
-  plumed_dbg_assert( vec.size()==getNumberOfQuantites()-5 && tvals.size()>1 );
+  plumed_dbg_assert( vec.size()==mybasemulticolvars[0]->getNumberOfQuantites()-5 && tvals.size()>1 );
   getValueForBaseTask( iatom, tvals ); for(unsigned i=0;i<vec.size();++i) vec[i]=tvals[i+1];
 }
 
diff --git a/src/vesselbase/BridgeVessel.cpp b/src/vesselbase/BridgeVessel.cpp
index 68007cf0679e99b96d9bf665978ca06d2cdee6fa..a84b8bf5df298c0ae7d81bb36715c5205645efe8 100644
--- a/src/vesselbase/BridgeVessel.cpp
+++ b/src/vesselbase/BridgeVessel.cpp
@@ -142,8 +142,9 @@ void BridgeVessel::completeNumericalDerivatives(){
 
 bool BridgeVessel::applyForce( std::vector<double>& outforces ){
   bool hasforce=false; outforces.assign(outforces.size(),0.0);
-  unsigned nextra = myOutputAction->getNumberOfDerivatives() - getAction()->getNumberOfDerivatives();
-  std::vector<double> eforces( nextra, 0.0 );
+  unsigned ndertot = myOutputAction->getNumberOfDerivatives();
+  unsigned nextra = ndertot - getAction()->getNumberOfDerivatives();
+  std::vector<double> forces( ndertot ), eforces( nextra, 0.0 );
   for(unsigned i=0;i<myOutputAction->getNumberOfVessels();++i){
      if( ( myOutputAction->getPntrToVessel(i) )->applyForce( forces ) ){
          hasforce=true;
diff --git a/src/vesselbase/BridgeVessel.h b/src/vesselbase/BridgeVessel.h
index b5998e1fb881ad4967d4707b327fa7c771142ae2..e42d34d7826de27662d709af06994d25fa8f9bdc 100644
--- a/src/vesselbase/BridgeVessel.h
+++ b/src/vesselbase/BridgeVessel.h
@@ -39,7 +39,6 @@ it is created in a different Action however.  At the moment this is used for reg
 
 class BridgeVessel : public Vessel {
 private:
-  std::vector<double> forces;
   unsigned inum;
   std::vector<double> mynumerical_values;
   ActionWithVessel* myOutputAction;
diff --git a/src/vesselbase/StoreDataVessel.cpp b/src/vesselbase/StoreDataVessel.cpp
index 42f6968fb7c50973489424e4799c37e2e9316152..488eecd35a258c70953bf6820f21a385f3a41703 100644
--- a/src/vesselbase/StoreDataVessel.cpp
+++ b/src/vesselbase/StoreDataVessel.cpp
@@ -172,7 +172,7 @@ double StoreDataVessel::chainRule( const unsigned& ival, const unsigned& ider, c
 }
 
 void StoreDataVessel::chainRule( const unsigned& ival, const std::vector<double>& df ){
-  plumed_dbg_assert( getAction->derivativesAreRequired() && df.size()==vecsize );
+  plumed_dbg_assert( getAction()->derivativesAreRequired() && df.size()==vecsize );
   // Clear final derivatives array
   final_derivatives.assign( final_derivatives.size(), 0.0 );