Safer update of location data, probably fixes crash around line 510