Passing by reference and not by value

(asked by Gareth)
Fixed regtest