Fix wrong calculation of data array