Fixed issue of reference overriding.
Introduced some code to do slighthly more dynamic tests