Handle nullpointerException for upload function; implement duplicate
check of locations across the data