Fixed a bug that always gets the first reading instead of the last