fix problem with nonetype location error