fixed sampling function, now working again ... was naming references