periodic distance bug fixed