added check for nil data
distance and lat/long fix