handle error in locs