modified location update

modified location update at beginning and index change