Fixed bug that led to inconsistent data.