fix undefined location error