fixed error on period measurement.