Fixed retrieval of sensor readings from the DB.