Fixed bugs with multiple outputing of the same data.